﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Srvtools;


public partial class Control_JobList : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            
        }
    }

    public void Bind()
    {
        DataTable JobDT = (DataTable)wdsJob.CommandTable;
        for(int i = 0; i < JobDT.Rows.Count; i ++)
        {
            Job.Items.Add(new ListItem(JobDT.Rows[i]["JobName"].ToString(),JobDT.Rows[i]["JobId"].ToString()));
        }

        Job.Items.Add(new ListItem("－－未选择－－", "0"));
        Job.Visible = true;
        LitJob.Visible = false;
    }

    public void ddlSelectValue(string Jid)
    {
        Bind();

        Job.SelectedValue = Jid;
    }

    public void ShowTextOnly(string Jid)
    {
        Bind();

        Job.SelectedValue = Jid;
        string Jname = Job.SelectedItem.Text;

        if (Jname == "－－未选择－－")
        {
            Jname = "无";
        }

        LitJob.Text = Jname;

        Job.Visible = false;
        LitJob.Visible = true;
    }

    public string SelectId
    {
        get
        {
            return Job.SelectedValue;
        }
        set
        {
            Job.SelectedValue = value;
        }
    }
}
